{extend name="layout_modal" /}
{block name="content"}
<section class="content" style="padding-top:0;padding-bottom: 0">
    <div class="row" style="padding-bottom: 0">
        <div class="box" style="margin-bottom: 0">
            <div class="box-body">
                <form role="form" action="{:url('set_dealer')}">
                    <table class="layui-table" lay-even>
                        <colgroup>
                            <col width="35">
                            <col width="30">
                        </colgroup>
                        <thead>
                            <tr>
                                <th><input type="checkbox" id="check_all"/></th>
                                <th>ID</th>
                                <th>经销商</th>
                            </tr>
                        </thead>
                        <tbody>
                            {volist name="lists" id="v"}
                            <tr>
                                <td><input type="checkbox" value="{$v.userid}" name="check_userids[]" class="dealer_check" {in name="$v.userid" value="$checked_userids"} checked {/in}> </td> 
                                <td>{$v.userid}</td>
                                <td>{$v.fullname}</td>
                            </tr>
                            {/volist}
                        </tbody>
                    </table>
                    <input type="hidden" name="couponsid" value="{$couponsid}">
                </form>
            </div>
        </div>
    </div>
</section>
{/block}
{block name="script"}
<script type="text/javascript">
    $(document).ready(function () {
        $('#check_all').click(function (item) {
            if ($('#check_all').is(':checked')) {
                $('.dealer_check').each(function () {
                    $(this).prop('checked', true);
                });
            } else {
                $('.dealer_check').each(function () {
                    $(this).prop('checked', false);
                });
            }
        });
    });
</script>
{/block}